<?xml version="1.0" encoding="UTF-8" ?> 
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
	<xsl:output method="html" omit-xml-declaration="yes" encoding="UTF-8" indent="yes"/>
	
	<xsl:include href="stylesheets/header.xsl"/>
	<xsl:include href="stylesheets/menuhorizontal.xsl"/>
	<xsl:include href="stylesheets/menuvertical.xsl"/>
	<xsl:include href="stylesheets/menurapido.xsl"/>
	<xsl:include href="stylesheets/plugins.xsl"/>
	<xsl:include href="stylesheets/footer.xsl"/>
	
<!-- ========================================================= -->	
<!-- ========================================================== -->
<!-- 					  HTML PRINCIPAL  						-->
<!-- ========================================================== -->
<!-- ========================================================== -->
	
	<xsl:template match="/">
	 	<html>
			<head>
				
				<META HTTP-EQUIV="Pragma" CONTENT="no-cache"/>
				
				<xsl:variable name="CONTEXTPATH" select="WEB/PAGE/GENERAL/contextPath"/>
				
				<!-- STYLES -->
				<link rel="stylesheet" href="{$CONTEXTPATH}/css/general/general.css" type="text/css"/>
				<link rel="stylesheet" href="{$CONTEXTPATH}/css/general/header.css" type="text/css"/>
				<link rel="stylesheet" href="{$CONTEXTPATH}/css/general/menuhorizontal.css" type="text/css"/>
				<link rel="stylesheet" href="{$CONTEXTPATH}/css/general/menuvertical.css" type="text/css"/>
				<link rel="stylesheet" href="{$CONTEXTPATH}/css/general/menurapido.css" type="text/css"/>
				<link rel="stylesheet" href="{$CONTEXTPATH}/css/general/popup.css" type="text/css"/>
				
				<!-- PLUGINS -->
				<link rel="stylesheet" href="{$CONTEXTPATH}/css/general/plugins/plugins.css" type="text/css"/>
				<link rel="stylesheet" href="{$CONTEXTPATH}/css/general/plugins/notificaciones/alerta-notificacion.css" type="text/css"/>
				<link rel="stylesheet" href="{$CONTEXTPATH}/css/general/plugins/notificaciones/plugin-notificaciones.css" type="text/css"/>
				<link rel="stylesheet" href="{$CONTEXTPATH}/css/general/plugins/barraSession/barra-session.css" type="text/css"/>
				
				
				<xsl:for-each select="WEB/PAGE//add[@type='stylesheet']">
					<link rel="stylesheet" href="{$CONTEXTPATH}/css/{@src}" type="text/css"/>
				</xsl:for-each>
            	
				<!-- SCRIPTS -->
				<script> var GLOBAL_CONTEXTPATH = '<xsl:value-of select="$CONTEXTPATH"/>'; window.history.forward(0);</script>
				<script type="text/javascript" src="{$CONTEXTPATH}/js/jsonrpc/jsonrpc.js"></script>
				<script type="text/javascript" src="{$CONTEXTPATH}/js/jquery/ui/jquery-1.4.4.min.js"></script>
				<script type="text/javascript" src="{$CONTEXTPATH}/js/jquery/ui/jquery-ui-1.8.11.custom.min.js"></script>
				<script type="text/javascript" src="{$CONTEXTPATH}/js/jquery/ui/jquery.tools.min.js"></script>
				<script type="text/javascript" src="{$CONTEXTPATH}/js/jquery/ui/jquery.nivo.slider.pack.js"></script>
				
				
				<script type="text/javascript" src="{$CONTEXTPATH}/js/general/osm-core.js"></script>
				<script type="text/javascript" src="{$CONTEXTPATH}/js/general/ui-jcore.js"></script>
				<script type="text/javascript" src="{$CONTEXTPATH}/js/general/si.files.js"></script>
				
				<!-- PLUGINS -->
				
				<!-- VARIABLES -->
				<script type="text/javascript" src="{$CONTEXTPATH}/js/general/init.js"></script>
				
					
												
            	<xsl:for-each select="WEB/PAGE//add[@type='script']">
					<script type="text/javascript" src="{$CONTEXTPATH}/js/{@src}"></script>
				</xsl:for-each>
				
			</head>
			
			<body>
				
				
				<!-- SE MUESTRA EL CONTENIDO SEGUN EL ESQUEMA ESPECIFICADO -->
				<xsl:choose>
					<xsl:when test="count(//esquemaCF)>0">
						<xsl:call-template name="esquemaCF"/>	
					</xsl:when>
					
					<xsl:when test="count(//esquemaC)>0">
						<xsl:call-template name="esquemaC"/>
					</xsl:when>
					
					<xsl:otherwise>
						<xsl:call-template name="esquemaC"/>
					</xsl:otherwise>
				
				
				</xsl:choose>		
			
				
				
			</body>
		</html>
		
	</xsl:template>
	
<!-- ========================================================== -->
<!-- = ESQUEMAS DE VISUALIZACION ==============================	-->
<!-- ========================================================== -->

<!-- = header,menu, plugins,contenido, footer, barraSession ================= -->	

	
<!-- = header, menu, contenido, footer, barraSession ======================== -->	
	
<!-- = header, contenido, footer, barraSession ================================ -->	
	<xsl:template name="esquemaCF">
		
		
				
		<!-- CONTENIDO -->
		<div style="margin:15px 0 15px 0" >
			<xsl:apply-templates select="WEB/PAGE/*"/>
			
			<xsl:call-template name="form-registrarse">
				<xsl:with-param name="visible">true</xsl:with-param>
			</xsl:call-template>
			
		</div>
		
		<xsl:call-template name="footer">
			<xsl:with-param name="visible">true</xsl:with-param>
		</xsl:call-template>
				
	</xsl:template>	

<!-- = solo el contenido ====================================== -->	
	<xsl:template name="esquemaC">
		<!-- contenido -->
		<div style="margin:15px 0 15px 0" >
					
			<xsl:apply-templates select="WEB/PAGE/*"/>
		</div>
		
	</xsl:template>
	
	
<!-- ========================================================== -->
<!-- = EXCLUYENTES DE XML =====================================	-->
<!-- ========================================================== -->
	<xsl:template match="add">
	</xsl:template>
	
	<xsl:template match="esquemaHMPCF">
	</xsl:template>
	
	<xsl:template match="esquemaHMCPF">
	</xsl:template>
	
	<xsl:template match="esquemaHMCF">
	</xsl:template>
	
	<xsl:template match="esquemaHCF">
	</xsl:template>
	
	<xsl:template match="esquemaC">
	</xsl:template>
	
	<xsl:template match="GENERAL">
	</xsl:template>
	
	<xsl:template match="ACCESS_INFO">
	</xsl:template>
	
	<xsl:template match="PARAMETERS">
	</xsl:template>
	
	<xsl:template match="ATTRIBUTES">
	</xsl:template>
	
	<xsl:template match="SESSION">
	</xsl:template>
	
	<xsl:template match="PAGEDATA">
	</xsl:template>
	
<!-- ========================================================== -->
<!-- = TRANSFORMADORES ========================================	-->
<!-- ========================================================== -->
	<xsl:template match="@*|node()" priority="-1">
	    <xsl:copy>
	        <xsl:apply-templates select="@*|node()"/>
	    </xsl:copy>
	</xsl:template>

	<xsl:template match="form">
		<form action="{@destino}" method="post" enctype="{@enctype}" onsubmit="return false;">
			<xsl:if test="string-length(@id)>0">
				<xsl:attribute name="name"><xsl:value-of select="@id"/></xsl:attribute>
				<xsl:attribute name="id"><xsl:value-of select="@id"/></xsl:attribute>
			</xsl:if>
			<xsl:apply-templates/>
		</form>
	</xsl:template>
	
	<xsl:template match="separador">
		<div class="separador">&#160;</div>
	</xsl:template>
	
	<xsl:template match="clearboth">
		<div class="clearboth">&#160;</div>
	</xsl:template>
	
	<xsl:template match="mensaje">
		<div class="area-msg corner margen-interna ">
			<div class="icono-msg {@tipo}">&#160;</div>
			<div class="content-msg {@tipo} corner">
				<div class="title-msg {@tipo}"><xsl:value-of select="titulo"></xsl:value-of></div>
				<div style="padding: 5px 0px;">
					<div><xsl:copy-of select="contenido"></xsl:copy-of></div>
				</div>	
			</div>
			<div class="clearboth">&#160;</div>	
		</div>
	</xsl:template>
	
	<xsl:template match="seccion">
		<div class="bg-seccion corner">
		<div class="seccion corner margen-interna">
			<h1><xsl:apply-templates select="titulo"/></h1>
			<div class="corner seccion-contenido">
				<xsl:apply-templates select="contenido/*"/>
			</div>
		</div>
		</div>
	</xsl:template>
		
	<xsl:template match="subseccion">
		<h3><xsl:value-of select="titulo"></xsl:value-of></h3>
		<div class="subseccion">
			<xsl:apply-templates select="contenido/*"></xsl:apply-templates>
		</div>
	</xsl:template>
	
	<xsl:template match="canvas">
		<div class="bg-canvas corner">
		<div class="canvas corner">
			<h1 class="canvas-titulo"><xsl:value-of select="titulo"></xsl:value-of></h1>
			<div class="canvas-contenido">
				<xsl:apply-templates select="contenido/*"></xsl:apply-templates>
			</div>
		</div>
		</div>
	</xsl:template>
	
	
	<xsl:template match="popup">
		<div class="popup" id="{@id}" >
			<xsl:attribute name="style">
				<xsl:if test="string-length(@display)>0">display:<xsl:value-of select="@display"/>;</xsl:if>
			</xsl:attribute>
			<div class="popup_margin margen-interna corner">
				<div class="popup-content corner margen-interna ">
					<h2><xsl:value-of select="titulo"></xsl:value-of></h2>
					<div style="margin: 20px 10px 20px 10px;">
						<xsl:apply-templates select="contenido/*"></xsl:apply-templates>
					</div>
				</div>
			</div>		
		</div>
	</xsl:template>
	
	<xsl:template match="combobox">
		<xsl:variable name="idcombo"><xsl:value-of select="@id"/></xsl:variable>		 	
		 
		 	
		<div class="combo">
		 	<div class="boton combo corner" onclick="toogleCombo('{$idcombo}_opciones');">
		 		<div style="float:left; margin:0 10px;" id="{$idcombo}_titulo">--Seleccione--</div>
		 	 	<div style="float:right; margin:0 10px;"> v </div>
		 	 	<div class="clearboth">&#160;</div>
		 	 		
		 	</div>
		 	<input id="{$idcombo}" name="{$idcombo}" type="hidden" value="{@value}"/>
		 	
		 	
		 	<!-- Opciones -->
		 	<div id="{$idcombo}_opciones" class="bg-combo-options corner" style="display:none">
		 		<div class="combo-option inicio" onclick="setValorCombo('{$idcombo}', '' , '{$idcombo}_titulo', '--Seleccione--'); toogleCombo('{$idcombo}_opciones');" >
		 			--Seleccione--
		 		</div>
		 		
		 		<xsl:apply-templates select="option">
            		<xsl:with-param name="idcombo" select="$idcombo"/>
            	</xsl:apply-templates>
		 		
				
		 	</div>
		</div>
	
	</xsl:template>
	
	<xsl:template match="option">
		<xsl:param name="idcombo"/>
		<xsl:choose>
			<xsl:when test="position() = last()">
				<div class="combo-option fin"  onload="alert('hola');" onclick="setValorCombo('{$idcombo}', '{@value}', '{$idcombo}_titulo', '{@text}'); toogleCombo('{$idcombo}_opciones');">
					<xsl:copy-of select="./*"/>
				</div>
			</xsl:when>
			<xsl:otherwise>
				<div class="combo-option"   onclick="setValorCombo('{$idcombo}', '{@value}', '{$idcombo}_titulo', '{@text}'); toogleCombo('{$idcombo}_opciones');">
					<xsl:copy-of select="./*"/>
				</div>
			</xsl:otherwise>
		
		</xsl:choose>
		
	
	</xsl:template>
	
	
	<xsl:template match="areabotones">
		<xsl:variable name="aling">
			<xsl:choose>
				<xsl:when test="string-length(@aling)>0">
					<xsl:value-of select="@aling"/>
				</xsl:when>
				
				<xsl:otherwise>
					center
				</xsl:otherwise>
				
			</xsl:choose>
		</xsl:variable>
	
		<div class="contenedor-botones corner" style="text-align: {$aling};">
				<div class="corner" style="display:inline-block;" >
					<div class="area-botones corner">
						<xsl:copy-of select="./*"/>
					</div>
				</div>
		</div>					
	</xsl:template>
	
	<xsl:template match="filechooser">
		<div class="filechooser">
      		<div class="titulo-filechooser">
      			<input class="inputfile" type="file" value="" alias="" reference="" name="{@id}" id="{@id}" onchange="mostrarArchivoFilechooser('{@id}', 'filechooser_archivo_{@id}')"/>
      			
      		</div>
      	</div>
      	
      	<div id="div_filechooser_{@id}" style="display:none">
	   		<div style="float:left" class="icon-mini-archivo"/>
    	  	<div style="float:left" class="archivo-filechooser" id="filechooser_archivo_{@id}"></div>
      		<div class="clearboth">&#160;</div>
      	</div>
		
	</xsl:template>
	
	<xsl:template match="ayuda">
		<div>
			<table class="table-formulario">
			   <tbody>
			    <tr>
			      <td class="">
			      	<div class="icon-mini-info"></div>
			      </td>
			      <td >
			      	<div class="mensaje-ayuda"><xsl:value-of select="."></xsl:value-of></div>	
			      </td>
			    </tr>
			  </tbody>
			</table>
		</div>
		
	</xsl:template>
	

	
	
</xsl:stylesheet>